<template>
	<view class="container">
		<view class="form" v-if="form.id">
			<view class="form-column-item">
				<view class="label">标题</view>
				<view class="content">
					<view class="">{{form.demandTitle}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">施工地点</view>
				<view class="content">
					<view class="">{{form.province}}{{form.city}}{{form.area}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">详细地址</view>
				<view class="content">
					<view class="">{{form.address}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">需求类型</view>
				<view class="content">
					<view class="">{{form.demandType | demandType}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">类别</view>
				<view class="content">
					<view class="">{{form.productType | productType}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">详细介绍</view>
				<view class="content">
					<view class="">{{form.intro}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">工期进度</view>
				<view class="content">
					<view class="">{{form.schedule}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">进场时间</view>
				<view class="content">
					<view class="">{{form.entryTime}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">付款方式</view>
				<view class="content">
					<view class="">{{form.paymentWay | paymentWay}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">发票</view>
				<view class="content">
					<view class="">{{form.invoiceWay | invoiceWay}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">联系人</view>
				<view class="content">
					<view class="">{{form.contactName}}</view>
				</view>
			</view>
			<view class="form-column-item">
				<view class="label">联系方式</view>
				<view class="content">
					<view class="">{{form.contactPhone}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getDemand
	} from '@/api/demand.js'
	import { demandType, productType, payType, invoiceType, const2Arr } from '../../consts'
	export default {
		data() {
			return {
				form: {},
				id: ''
			}
		},
		onLoad(option) {
			this.id = option.id
			this.getDemand()
		},
		filters:{
			demandType(val){
				return const2Arr(demandType).find(item => item.value === val).label
			},
			productType(val){
				return const2Arr(productType).find(item => item.value === val).label
			},
			paymentWay(val){
				return const2Arr(payType).find(item => item.value === val).label
			},
			invoiceWay(val){
				return const2Arr(invoiceType).find(item => item.value === val).label
			}
		},
		methods: {
			getDemand() {
				getDemand({ id: this.id }).then(res => {
					this.form = res.result
				})
			}
		}
	}
</script>

<style lang="scss">
.content{
	font-size: 28rpx !important;
}
</style>